package m.server.web.req;

import m.system.util.StringUtil;

public enum HttpMethod {
    GET,
    POST,
    PUT,
    DELETE,
    PATCH,
    HEAD,
    OPTIONS,
    TRACE,
    CONNECT,
    ALL
    ;
    public static HttpMethod to(String name){
        if(StringUtil.notSpace(name)) {
            for (HttpMethod m : values()) {
                if (m.name().equals(name.toUpperCase())) {
                    return m;
                }
            }
        }
        return null;
    }

    @Override
    public String toString() {
        return name();
    }
}
